package com.ruoyi.business.service;

import com.ruoyi.business.domain.BusinessTradeRecord;
import com.ruoyi.business.dto.PSIceOrderStatus;
import com.ruoyi.business.dto.PSIceTransStatus;
import com.ruoyi.business.dto.RateStatisticsDTO;
import com.ruoyi.business.enumType.PSIceOrderType;
import com.ruoyi.business.enumType.TriggerType;
import com.ruoyi.common.core.domain.AjaxResult;

import java.math.BigDecimal;
import java.util.List;

/**
 * 交易记录Service接口
 * 
 * @author ruoyi
 * @date 2024-04-15
 */
public interface IBusinessTradeRecordService 
{
    /**
     * 查询交易记录
     * 
     * @param id 交易记录主键
     * @return 交易记录
     */
    public BusinessTradeRecord selectBusinessTradeRecordById(Long id);

    /**
     * 查询交易记录列表
     * 
     * @param businessTradeRecord 交易记录
     * @return 交易记录集合
     */
    public List<BusinessTradeRecord> selectBusinessTradeRecordList(BusinessTradeRecord businessTradeRecord);

    /**
     * 新增交易记录
     * 
     * @param businessTradeRecord 交易记录
     * @return 结果
     */
    public AjaxResult tradeAndInsertBusinessTradeRecord(BusinessTradeRecord businessTradeRecord);

    /**
     * 修改交易记录
     * 
     * @param businessTradeRecord 交易记录
     * @return 结果
     */
    public int updateBusinessTradeRecord(BusinessTradeRecord businessTradeRecord);

    /**
     * 批量删除交易记录
     * 
     * @param ids 需要删除的交易记录主键集合
     * @return 结果
     */
    public int deleteBusinessTradeRecordByIds(Long[] ids);

    /**
     * 删除交易记录信息
     * 
     * @param id 交易记录主键
     * @return 结果
     */
    public int deleteBusinessTradeRecordById(Long id);

    AjaxResult cancleOrder(BusinessTradeRecord businessTradeRecord);


    PSIceTransStatus selectCurrentTransTradeOrderByOrderNo(String orderNo,String clientName,String password);

    PSIceOrderStatus selectCurrentDelegateTradeOrderByOrderNo(String orderNo,String clientName,String password );


    List<BusinessTradeRecord> selectTodayTradeRecord();

//    BusinessTradeRecord getTradeOrderByRules(PSIceOrderType psIceOrderType, TriggerType triggerType);

    AjaxResult doBusinessTradeByStopProfitOrLoss(Long id, PSIceOrderType psIceOrderType, BusinessTradeRecord businessTradeRecord, BigDecimal price, TriggerType triggerType);


     AjaxResult doBusinessTradeAuto(Long strategyId, PSIceOrderType psIceOrderType, BigDecimal price, BigDecimal open, String symbol, Boolean orFirstTrade, String orderNo);

    RateStatisticsDTO winRateStatistics(String type);
}
